<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增文章搜索词管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-terms-add">

            <input name="titleId" type="hidden" id="treeId"/>


                <div class="form-group">
                    <label class="col-sm-3 control-label is-required" >归属部门：</label>
                    <div class="col-sm-8">
                        <div class="input-group">
                            <input name="deptName" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择归属部门" class="form-control" required>
                            <span class="input-group-addon"><i class="fa fa-search"></i></span>
                        </div>
                    </div>
                </div>



            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">搜索词：</label>
                <div class="col-sm-8">
                    <input name="searchTerms" class="form-control" type="text" required>
                </div>
            </div>
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label is-required">小标题：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="subheading" class="form-control" type="text" required>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label is-required">大标题：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <select name="bigHeadline" class="form-control m-b" th:with="type=${@dict.getType('ds_history')}" required>-->
<!--                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
<!--                    </select>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">简介：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="briefIntroduction" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "front/terms"
        $("#form-terms-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-terms-add').serialize());
            }
        }












        function selectDeptTree() {
            var treeId = $("#treeId").val();
            var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
            var url = ctx + "front/terms/selectTitleTreenew/" + deptId;
            var options = {
                title: '选择部门',
                width: "380",
                url: url,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = $.modal.getChildFrame(index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            $.modal.close(index);
        }

        $(function() {
            $('#post').select2({
                placeholder: "请选择岗位",
                allowClear: true
            });
        })



    </script>
</body>
</html>